Briefly described, a binary tree allows for a two-way divergence from a “branch point.” Depending on the output of the evaluated condition, the binary tree follows one of two divergent paths. Unlike binary trees, ternary trees allow for a three-way divergence at a branch point. Ternary trees evaluate a condition for three possible outputs, and, depending on the output of the evaluated condition, the ternary tree follows one of the three divergent paths. Ternary trees have been used for several years to perform searching algorithms because ternary trees are faster than conventional hashing or indexing methods that handle comparable tasks.
Traditionally, in order to perform a general-purpose search, such as a binary or ternary tree, a processor performed two separate tests to determine the “direction” of the search. This is shown in FIG. 11. In the first step 1110, a processor would evaluate between the two conditions A=B (equality condition) and A≠B (inequality condition). From here, if an equality condition is met, then the processor would execute, in step 1140, an instruction set associated with the equality condition. If, on the other hand, the inequality condition A≠B is met, then the processor would evaluate, in step 1150, between the two inequality conditions A<B and A>B. If the A<B condition was met, then the processor would execute, in step 1165, the instruction set associated with that inequality. On the other hand, if the A>B condition was met, then the processor would execute, in step 1175, the instruction set associated with that inequality condition. Once the appropriate instruction set has been executed, the processor, in step 1180, continues with the instructions found at a common address. This two-step process may be simplified by using a ternary branch instruction, which evaluates the three conditions (i.e., A=B, A<B, and A>B) in a single step.
While limited attempts have been made to perform ternary branch instructions, these attempts have failed to truly implement a general ternary branch instruction. Thus, there is a need in the art for a system and method that is capable of performing a general ternary branch instruction.